home *** CD-ROM | disk | FTP | other *** search
/ CD ROM Paradise Collection 4 / CD ROM Paradise Collection 4 1995 Nov.iso / program / swagg_m.zip / KEYBOARD.SWG / 0029_Another READKEY in ASM.pas < prev    next >
Pascal/Delphi Source File  |  1993-07-16  |  2KB  |  56 lines

  1. ===========================================================================
  2.  BBS: The Beta Connection
  3. Date: 06-20-93 (12:25)             Number: 1081
  4. From: YVAN RIVARD                  Refer#: 984
  5.   To: BOB GIBSON                    Recvd: NO  
  6. Subj: console I/O                    Conf: (232) T_Pascal_R
  7. ---------------------------------------------------------------------------
  8. BG> You know, since I wrote my own unit to replace CRT, you'd think I'd know
  9. BG> something like that!
  10. BG> Which brings up a question...my unit uses direct video writes, and
  11. BG> (supposedly) so does TP unless you tell it otherwise.  So why does my
  12. BG> unit do a screen faster than TP's units?  Not as much overhead?
  13.  
  14. You made your own 'Crt'? I'd like some help!
  15. The only thing I haven't been able to do so far is the stupid KeyPressed...
  16. I have successfully made a really good ReadKey (return a String [2], so I can
  17. even read arrows, Functions keys (even F11 and F12))
  18.  
  19. Here's my ReadKey (I case anybody would like to have it),
  20. but I you could help me with the KeyPressed...
  21. (Byt the way, does your 'direct video' is made like this?
  22.  Type
  23.     VideoChar = Record
  24.                    Ascii : Char;
  25.                    Color : Byte;
  26.                 end;
  27.     Var
  28.        VideoRam : Array [1..25,1..80] of VideoChar Absolute $B800:0000; )
  29.  
  30. Here's my 'ReadKey':
  31.  
  32. Function Inkey : String;
  33.    Var
  34.       K : Word;
  35.       T : String [2];
  36.    Begin
  37.       Asm
  38.          mov  ah, 10h
  39.          int  16h
  40.          mov  K, ax
  41.       end;
  42.       T := '';
  43.       If ((K and 255) = 0) or ((K and 255) = 224) then
  44.          T := ' '+ Chr (Trunc ((K and 65280) / 256))
  45.       else
  46.          T := Chr (K and 255);
  47.       Inkey := T;
  48.    End;
  49.  
  50. So what about a 'KeyPressed' ?
  51.  
  52. Thanks 'n bye
  53. ---
  54.  * Info Tech BBS 819-375-3532
  55.  * PostLink(tm) v1.06  ITECH (#535) : RelayNet(tm)
  56.